package com.gxa.usermanagement.controller;

import com.gxa.common.R;
import com.gxa.common.entity.usermange.VipUser;
import com.gxa.common.entity.usermange.VipUserAuditing;
import com.gxa.usermanagement.service.VipUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@CrossOrigin
@RestController
public class VipUserController {

    @Autowired
    private VipUserService vipUserService;

    @GetMapping("/findVipUserBy")
    public R findVipUserByController(Integer currentPage, Integer pageSize, Integer id,String vipuserName,String vipuserPhone,String vipuserEmile,Integer state){
        return vipUserService.findVipUserByService(currentPage,pageSize,id,vipuserName,vipuserPhone,vipuserEmile,state);
    }

    @GetMapping("/updateVipUser")
    public R updateVipUserController(Integer id, Integer state, VipUserAuditing vipUserAuditing){
        return vipUserService.updateVipUserService(id,state ,vipUserAuditing);
    }

    @GetMapping("/findVipUserAll")
    public R findVipUserAllController(Integer currentPage,Integer pageSize){
        return vipUserService.findVipUserAllService(currentPage,pageSize);
    }

    @RequestMapping(value = "/findIdsByNickname" , method = RequestMethod.GET)
    public List<Long> findIdsByNickname(String vipuserName){
        return vipUserService.findIdsByNickname(vipuserName);
    }


    @RequestMapping(value = "/findAllById" , method = RequestMethod.GET)
    public VipUser findAllById(Long id){
        return vipUserService.findAllById(id);
    }
}
